package cn.diancan.model;


import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Version;

import cn.diancan.util.DateUtil;

@Entity
public class Specification   {
	
	
	private Long id;//主键
	private String name; // 规格名称
	//private Long shopId; // 店铺Id
	private Integer orderNo; // 排序
	
	
	private String memo; // 备注
	private String valueStr="";  //规格值文本 用空格分开例如："白色 黑色 黄色"
	private Integer valueSize; //规格值数量
	private Integer isDelete;//删除标识
	private String createTime; //
	private String modifyTime;
	
	private List<SpecificationValue> valueList; //规格值列表
	    private Integer version;
	    
	    @Version
	    @Column(name="OPTLOCK",columnDefinition="int(11) DEFAULT 0")
	    public Integer getVersion() {
	        return version;
	    }
	    public void setVersion(Integer version) {
	        this.version = version;
	    }
	
	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	} 
	
	public Integer getOrderNo() {
	    return orderNo;
	}
	public void setOrderNo(Integer orderNo) {
	    this.orderNo = orderNo;
	}
	public Integer getIsDelete() {
		return isDelete;
	}
	public void setIsDelete(Integer isDelete) {
		this.isDelete = isDelete;
	}
	public String getMemo() {
		return memo;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	public String getValueStr() {
		return valueStr;
	}
	public void setValueStr(String valueStr) {
		this.valueStr = valueStr;
	}
	@Column(name="createTime",columnDefinition="DATETIME")
 	public String getCreateTime() {
	    return DateUtil.getMysqlDateTime(createTime);
	}
	public void setCreateTime(String createTime) {
	    this.createTime = createTime;
	}
	
	    @Column(name="modifyTime",columnDefinition="DATETIME")
	    public String getModifyTime() { 
	        return DateUtil.getMysqlDateTime(modifyTime);
	    }
	public void setModifyTime(String modifyTime) {
	    this.modifyTime = modifyTime;
	}
	@OneToMany(mappedBy="specification",cascade=CascadeType.ALL,fetch = FetchType.LAZY)
 	public List<SpecificationValue> getValueList() {
		return valueList;
	}
	public void setValueList(List<SpecificationValue> valueList) {
		this.valueList = valueList;
	}
	public Integer getValueSize() {
	    return valueSize;
	}
	public void setValueSize(Integer valueSize) {
	    this.valueSize = valueSize;
	}  
	
	 
}
